﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="Skyworth.CRM.Web.Login" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>销售管理平台 | 系统登陆</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=7" />   
    <link href="themes/css/login.css" rel="stylesheet" type="text/css" />
    <script src="javascripts/jquery-1.4.4.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#btnLogin").click(function () {
                var txtUserName = $("#txtUser").val();
                var txtPassword = $("#txtPassword").val();
                var txtVerify = $("#txtVerify").val();
                if (txtUserName.length == 0) {
                    alert("用户名不可以为空,请重新输入!");
                    $("#txtUser").focus();
                    return false;
                }
                if (txtPassword.length == 0) {
                    alert("密码不可以为空,请重新输入!");
                    $("#txtPassword").focus();
                    return false;
                }
                if (txtVerify.length == 0) {
                    alert("验证码不可以为空,请重新输入!");
                    $("#txtVerify").focus();
                    return false;
                }
                var data = {
                    UserName: txtUserName,
                    Password: txtPassword,
                    VerifyCode: txtVerify
                };
                $.post("Service/Login.ashx", data, function (result) {
                    if (result == "1") {
                        document.location.href = "Default.aspx";
                    }
                    else if (result == "0") {
                        alert("登录失败,用户名或密码错误!");
                    }
                    else if (result == "2") {
                        alert("对不起,验证码错误!");
                    }
                    else if (result == "3") {
                        alert("对不起,您的浏览器设置已被禁用Cookies,您必须设置浏览器允许使用Cookies选项后才能使用本系统!");
                    }
                    else {
                        alert("对不起,程序错误,请联系系统管理员!");
                    }
                });
            });
            $("#btnCancel").click(function () {
                window.close();
            })
            $("div.button").hover(function () { $(this).addClass("buttonHover"); },
               function () { $(this).removeClass("buttonHover"); });
            $(".login-area ul li input").hover(function () { $(this).addClass("txtOn"); },
                                                function () { $(this).removeClass("txtOn"); })
        })
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="login">
        <div class="login-top">&nbsp;
        </div>
        <div class="log-info">
            <div class="login-title">
                <img src="themes/default/images/login/logo.jpg" alt="创维电器CRM系统V1.0" /></div>
            <div class="login-area">
                <ul>
                    <li><span>用户名：</span>
                        <input id="txtUser" type="text" maxlength="25" onclick="$.trim(this.value)" class="txt user" />
                    </li>
                    <li><span>密码：</span>
                        <input id="txtPassword" maxlength="20" onclick="$.trim(this.value)" class="txt password" type="password" /></li>
                    <li><span>验证码：</span>
                        <input id="txtVerify" name="txtVerify" maxlength="10" onclick="$.trim(this.value)" type="text" class="txt password width200" />
                        <img src="service/VerifyImage.ashx" alt="看不清,点击更换!" onclick="this.src=this.src+'?'" style="height: 40px;
                            width: 120px; vertical-align: middle"  />
                    </li>
                </ul>
            </div>
            <div class="buttonLayout">
                <a href="javascript:void(0)">
                     <input id="btnLogin" tabindex="1" type="button" class="btnLogin" title="登陆到系统" />
                </a><a href="javascript:void(0)">
                    <input id="btnCancel" type="button" tabindex="2" class="btnCancel" title="取消登陆" />
                </a>
            </div>
        </div>
        <div class="login-bottom">
        </div>
    </div>
    <div id="login-botton">
        <div id="leftText">
            <span>DESIGNED BY JIAZHITENG</span></div>
        <div id="rightText">
            <span>POWERED BY Skyworth &copy; 2000-2011,All Rights Reserved</span></div>
    </div>
    </form>
</body>
</html>
